package com.zoranjoka.chordis.pages;

import java.util.ArrayList;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.PageAttached;

import com.zoranjoka.chordis.beans.SongBean;
import com.zoranjoka.chordis.data.MockDataSong;

public class Songs {
	private MockDataSong dataSongs;

	private SongBean songBean;

	@InjectPage
	private SongDetails sdPage;

	@PageAttached
	private void InitData() {
		dataSongs = new MockDataSong();
	}

	@OnEvent(component = "songDetalilsLink")
	public Object onShowDetails(String name) {
		SongBean songBean = dataSongs.getSongByName(name);
		sdPage.setSong(songBean);
		return sdPage;
	}

	public ArrayList<SongBean> getAllSongs() {
		return dataSongs.getAllSongs();
	}

	public SongBean getSongs() {
		return songBean;
	}

	public void setArtist(SongBean s) {
		songBean = s;
	}

}
